﻿#pragma once
#include "AsQBasicGlobal.h"
#include <vector>

__AS_JY(Update 2023.1.7)
namespace As {

	AS_QBASIC_EXPORT QString toqstr(const std::string& str);

	AS_QBASIC_EXPORT std::string tostr(const QString& str);

	AS_QBASIC_EXPORT std::string strWindowsPath(QString path);

	AS_QBASIC_EXPORT QString strCurrentDateTimeSerial();

	AS_QBASIC_EXPORT QString strCreateUuid();

	AS_QBASIC_EXPORT QString strExe();

	AS_QBASIC_EXPORT QString strRect(const QRect& rect);
	AS_QBASIC_EXPORT QRect fromStr(const QString& str);

	AS_QBASIC_EXPORT QString strn26(int number);
	AS_QBASIC_EXPORT int from_strn26(const QString strNumber);

	AS_QBASIC_EXPORT QString formatDict(int index,QStringList dict);	//按索引format字典

	template<typename _TYPE>
	QString toString(void* data) 
	{
		QString result = QVariant(qMetaTypeId<_TYPE>(), data).toString();
		return result;
	}

	template<typename _TYPE>
	void fromString(QString from, void* to)
	{
		if (typeid(_TYPE).name() == typeid(QString).name())
			*(QString*)to = from;
		else
			QVariant(from).convert(qMetaTypeId<_TYPE>(), to);
	}

};
